@layout("/common/_container.html"){
<div class="ibox float-e-margins">
    <div>
    
        <div class="form-horizontal" style='overflow:scroll;'>

             <input type="hidden" id="id" name="id" value="${item.carryBasicInformation.id}">
	
	<div>
			
			<form id="carryBasicInformation">
				<table border="1" cellpadding="4px" width="1000px">
					<tr>
						<td>基本信息：</td>
						<td colspan="7"></td>
					</tr>
					<tr>
						<td>装车编号:</td>
						<td>${item.carryBasicInformation.carryId}</td>
						<td>装车日期:</td>
						<td>${tool.dateType(item.carryBasicInformation.carryDate)}</td>
						<td>制单员:</td>
						<td>${item.carryBasicInformation.carryTradePerson}</td>
						<td>审核员:</td>
						<td>${item.carryBasicInformation.carryCheck}</td>
					</tr>
					<tr>
						<td>车号:</td>
						<td>${item.carryBasicInformation.carryCarId}</td>
						<td>驾驶员：</td>
						<td>${item.carryBasicInformation.carryCarDriver}</td>
						<td>联系电话：</td>
						<td>${item.carryBasicInformation.carryCarDriverTell}</td>
						<td>手机：</td>
						<td>${item.carryBasicInformation.carryCarDriverMobile}</td>
					</tr>
					<tr>
						<td>车次:</td>
						<td>${item.carryBasicInformation.carryNumber}</td>
						<td>物流线路:</td>
						<td>${item.carryBasicInformation.carryRouteId}</td>
						<td>始发站：</td>
						<td>${item.carryBasicInformation.carryRouteStart}</td>
						<td>到站：</td>
						<td>${item.carryBasicInformation.carryRouteEnd}</td>
					</tr>
					<tr>
						<td>备注：</td>
						<td colspan="7">${item.carryBasicInformation.carryRemark}</td>
					</tr>
				</table>
			</form>
	<br/>
			<div style='width:2550px;'>
			<form id="carryContractInformations">
				<table border="1" cellpadding="4px" width="2500px" class="table1">
					<tr>
						<td colspan="23">装车信息：</td>
					</tr>
					<tr>
						<td width="35px">序号</td>
						<td width="120px">合同号</td>
						<td width="70px">发货人</td>
						<td width="100px">发货人电话</td>
						<td width="250px">发货人地址</td>
						<td width="70px">收货人</td>
						<td width="100px">收货人电话</td>
						<td width="250px">收货人地址</td>
						<td width="145px">货物编号</td>
						<td width="250px">货物名称</td>
						<td width="250px">货物规格</td>
						
						<td width="100px">包装方式</td>
						<td width="115px">本次发货数量</td>
						<td width="100px">未发货数量</td>
						<td width="100px">库存总数量</td>
						<td width="90px">数量(件)</td>
						<td width="90px">重量(KG)</td>
						<td width="90px">体积(m³)</td>
						<td width="70px">运费</td>
						<td width="70px">信息费</td>
						<td width="70px">提货费</td>
						<td width="120px">仓库</td>
						<td width="130px">备注</td>
					</tr>
					 @for(carryContractInformation   in   item.modelCarryPrintItems){ 
					<tr id="a" class="a">
						<td >${carryContractInformationLP.index}</td>
						<td >${carryContractInformation.carryContractInformation.carryContractNumber}</td>
						<td >${carryContractInformation.carryContractInformation.carryConsignerName}</td>
						<td >${carryContractInformation.carryContractInformation.carryConsignerTell}</td>
						<td >${carryContractInformation.carryContractInformation.carryConsignerPlace}</td>
						<td >${carryContractInformation.carryContractInformation.carryConsigneeName}</td>
						<td >${carryContractInformation.carryContractInformation.carryConsigneeTell}</td>
						<td>${carryContractInformation.carryContractInformation.carryConsigneePlace}</td>
						<td>${carryContractInformation.carryContractInformation.carryGoodsId}</td>
						<td>${carryContractInformation.carryContractInformation.carryGoodsName}</td>
						<td>${carryContractInformation.carryContractInformation.carryGoodsModel}</td>
						<td>${carryContractInformation.carryContractInformation.carryGoodsPackage}</td>
						<td class="carryThisQuantity">${carryContractInformation.carryContractInformation.carryThisQuantity}</td>
						<td class="carryUnQuantity">${carryContractInformation.carryContractInformation.carryUnQuantity}</td>
						<td class="carryStockQuantity">${carryContractInformation.carryContractInformation.carryStockQuantity}</td>
						<td class="carryGoodsQuantity">${carryContractInformation.carryContractInformation.carryGoodsQuantity}</td>
						<td class="carryGoodsWeight">${carryContractInformation.carryContractInformation.carryGoodsWeight}</td>
						<td class="carryGoodsVolume">${carryContractInformation.carryContractInformation.carryGoodsVolume}</td>
						<td class="carryGoodsFreight">${carryContractInformation.carryContractInformation.carryGoodsFreight}</td>
						<td class="carryGoodsMessagefee">${carryContractInformation.carryContractInformation.carryGoodsMessagefee}</td> 
						<td class="carryGoodsPickupCharge">${carryContractInformation.carryContractInformation.carryGoodsPickupCharge}</td> 
						<td>${carryContractInformation.carryContractInformation.carryGoodsWarehouseName}</td> 
						<td>${carryContractInformation.carryContractInformation.carryGoodsRemark}</td> 
					</tr>
					@}
					<tr>
						<td >总计:</td>
						<td colspan="11"></td>
						<td id="carryCount"></td>
						<td  id="unCarryCount"></td>
						<td  id="stockCount"></td>
						<td  id="sumCount"></td>
						<td  id="sumWeight"></td>
						<td  id="sumVolume"></td>
						<td  id="sumFreight"></td>
						<td  id="sumMessagefee"></td>
						<td  id="sumPickupCharge"></td>
					</tr>
					</table>
					</form>
					</div>
			</div>
			
			<div class="row btn-group-m-t">
             	<div class="col-sm-5">
                </div>
                 @if(shiro.hasPermission("/carryBasicInformation/print")){
                <div class="col-sm-2">
                                <#button name="装车信息打印" btnCss="info" icon="fa-check" clickFun="preview()"/>
                </div>
                            @}
                 @if(shiro.hasPermission("/carryBasicInformation/anti")){
               			 <div id="anti" class="col-sm-1">
                                <#button name="反审核" btnCss="info" icon="fa-check" clickFun="CarryBasicInformationInfoDlg.editSubmit()"/>
               			 </div>
                            @}
                <div class="col-sm-1">
                    <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="CarryBasicInformationInfoDlg.close()"/>
                </div>
               <div class="col-sm-3">
                </div>
            </div>
        </div>
        <!--startprint-->
        <div id="print" style="display:none">
        <table>
        		<tr><td colspan="9" align="center"><font size="4">${company.companyName}货物起运清单</font></td></tr>
        		<tr>
        			<td>车牌号</td>
        			<td>${item.carryBasicInformation.carryCarId}</td>
        			<td></td>
        			<td>手机号</td>
        			<td>${item.carryBasicInformation.carryCarDriverMobile}</td>
        			<td></td>
        			<td>车次</td>
        			<td>${item.carryBasicInformation.carryNumber}</td>
        			<td>${tool.dateType(item.carryBasicInformation.carryDate)}</td>
        		</tr>
        		<tr>
        			<td colspan="9">
        			<table border="1" width='100%' height='100%'>
        			<tr>
        				<td>承运人</td>
        				<td>运单号</td>
        				<td>收货地址</td>
        				<td>收货人</td>
        				<td>收货人电话</td>
        				<td>货物名称</td>
        				<td>付款方式</td>
        				<td>送货方式</td>
        				<td>运费</td>
        			</tr>
        			 @for(carryContractInformation   in   item.modelCarryPrintItems){ 
        			 <tr class="piao">
        			 	<td>${item.carryBasicInformation.carryCarDriver}</td>
        			 	<td>${item.carryBasicInformation.carryId}</td>
        			 	<td>${carryContractInformation.carryContractInformation.carryConsigneePlace}</td>
        			 	<td>${carryContractInformation.carryContractInformation.carryConsigneeName}</td>
        			 	<td>${carryContractInformation.carryContractInformation.carryConsigneeTell}</td>
        			 	<td>${carryContractInformation.carryContractInformation.carryGoodsName}</td>
        			 	<td class="payType">${carryContractInformation.receiveBasicInformation.receivePaymentMethod}</td>
        			 	<td >${carryContractInformation.receiveBasicInformation.receiveShippingMethod}</td>
        			 	<td class="printFee">${carryContractInformation.carryContractInformation.carryGoodsFreight}</td>
        			 </tr>
        			 @}
        			</table>
        			</td>
        		</tr>
        		<tr >
        			 	<td colspan="7"></td>
        			 	<td >到付运费总计：</td>
        			 	<td id="printComeSumFee"></td>
        			 </tr>
        			  <tr >
        			  <td colspan="7"></td>
        			 	<td >运费总计：</td>
        			 	<td id="printSumFee"></td>
        			 </tr>
        			 <tr>
        			 	<td colspan="3"></td>
        			 	<td>总计货物票数</td>
        			 	<td id="xuHao"></td>
        			 	<td>票</td>
        			 	<td colspan="3"></td>
        			 </tr>
        		<tr>
        			<td colspan="9">
        			 <table>
			        	<tr><td align="center">承运协议</td></tr>
			        	<tr><td>1.承运方必须将货物准时、完好无损送到指定地点；</td></tr>
			        	<tr><td>2.承运方在运输途中确保货物安全，如丢失、雨淋、损坏均由承运方照价赔偿；</td></tr>
			        	<tr><td>3.承运方在托运方装车时，必须在现场点清货物数量，看清货物是否完好无损，否则视为承运方对货物的数量认为正常，并认为
			        	货物完好无损；如出现货物损坏、数量不够现象，均由承运方照价赔偿；</td></tr>
			        	<tr><td>4.本协议承运方、托运方签字或盖章后生效，货物安全运达目的地后终止</td></tr>
			        	<tr><td></td></tr>
			        	
			        </table>
        			</td>
        		</tr>
        		<tr>
			        	<td colspan="9">一联自存根          二联红车          三联分流表</td>
			    </tr>
        		<tr>
        			<td colspan="1"></td>
        			<td><font size="3">托运方</font></td>
        			<td colspan="5"></td>
        			<td><font size="3">承运方</font></td>
        			<td colspan="1"></td>
        		</tr>
        </table>
       
        
        
        </div>
        <!--endprint-->
    </div>
</div>
<script src="${ctxPath}/static/modular/query/carryBasicInformation/carryBasicInformation_info.js"></script>
<script>
//初始化库存总数量，数量，重量，体积，运费，信息费，提货费信息
function initCount(){
	//初始化库存总数量
	var a = 0;
	$(".carryStockQuantity").each(function(){
		var count ;
		count=Number($(this).text());
        	a += count;
	});
	$("#stockCount").text(a);
	
	//初始化数量
	var b = 0;
	$(".carryGoodsQuantity").each(function(){
		var count ;
		count=Number($(this).text());
        	b+= count;
	});
	$("#sumCount").text(b);
	
	//初始化重量
	var c = 0;
	$(".carryGoodsWeight").each(function(){
		var count ;
		count=Number($(this).text());
        	c+= count;
	});
	$("#sumWeight").text(c);
	
	//初始化体积
	var d = 0;
	$(".carryGoodsVolume").each(function(){
		var count ;
		count=Number($(this).text());
        	d+= count;
	});
	$("#sumVolume").text(d);
	
	//初始化运费
	var f = 0;
	$(".carryGoodsFreight").each(function(){
		var count ;
		count=Number($(this).text());
        	f+= count;
	});
	$("#sumFreight").text(f);
	
	//初始化信息费
	var g = 0;
	$(".carryGoodsMessagefee").each(function(){
		var count ;
		count=Number($(this).text());
        	g+= count;
	});
	$("#sumMessagefee").text(g);
	
	//初始化提货费
	var h = 0;
	$(".carryGoodsPickupCharge").each(function(){
		var count ;
		count=Number($(this).text());
        	h+= count;
	});
	$("#sumPickupCharge").text(h);
	
	//初始化本次发货数量
	var i = 0;
	$(".carryThisQuantity").each(function(){
		var count ;
		count=Number($(this).text());
        	i+= count;
	});
	$("#carryCount").text(i);
	
	
	//初始化未发货数量
	var j = 0;
	$(".carryUnQuantity").each(function(){
		var count ;
		count=Number($(this).text());
        	j+= count;
	});
	$("#unCarryCount").text(j);
	
	//初始化打印表的运费
	var k = 0;
	$(".printFee").each(function(){
		var count ;
		count=Number($(this).text());
        	k+= count;
	});
	$("#printSumFee").text(k);
	//初始化到付费用
	var l = 0;
	$(".payType").each(function(){
		var count ;
		if($(this).text()=="到付"){
		count=Number($(this).parent().children().last().text());
        l+= count;
		}
	});
	$("#printComeSumFee").text(l);
	
	//初始化序号
	var m = 0;
	$(".piao").each(function(){
		m++;
	});
	$("#xuHao").text(m);
}
$(function(){
	initCount();
});

function preview()    
{    
	$("#print").show();
	
		bdhtml=window.document.body.innerHTML; 

		sprnstr="<!--startprint-->"; //开始打印标识字符串有17个字符

		eprnstr="<!--endprint-->"; //结束打印标识字符串

		prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17); //从开始打印标识之后的内容

		prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr)); //截取开始标识和结束标识之间的内容

		window.document.body.innerHTML=prnhtml; //把需要打印的指定内容赋给body.innerHTML
		
		if (!!window.ActiveXObject || "ActiveXObject" in window) { //是否ie
			   remove_ie_header_and_footer();
			 }

		window.print(); //调用浏览器的打印功能打印指定区域

		window.document.body.innerHTML=bdhtml; // 最后还原页面
		$("#print").hide();
}  
	 function remove_ie_header_and_footer() {
	  var hkey_path;
	  hkey_path = "HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";
	  try {
	   var RegWsh = new ActiveXObject("WScript.Shell");
	   RegWsh.RegWrite(hkey_path + "header", "");
	   RegWsh.RegWrite(hkey_path + "footer", "");
	  } catch (e) {
	  }
	 }
</script>
@}
